package com.bdyc.util;

import java.io.FileOutputStream;
import java.io.InputStream;

public class FileUtil {

	public static boolean uploadFile(InputStream inputStream, String path) {
        try {
            // FileInputStream inputStream = new FileInputStream(file);
            FileOutputStream outputStream = new FileOutputStream(path);
            byte[] buf = new byte[2048];
            int length = 0;
            while ((length = inputStream.read(buf)) != -1) {
                outputStream.write(buf, 0, length);
            }
            inputStream.close();
            outputStream.flush();
            outputStream.close();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
	
}
